package com.hmall.item.web;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hmall.common.dto.PageDTO;
import com.hmall.item.pojo.Item;
import com.hmall.item.service.IItemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/item")
@Slf4j
public class ItemController {

    @Autowired
    private IItemService itemService;

    /**
     * 查询功能
     * @param page
     * @param size
     * @return
     */
    /* @GetMapping("/list")
    public PageDTO list(Integer page,Integer size){
        log.info("查询商品：page={},size={}",page,size);
        Page<Item> pageParam = new Page<>(page,size);
        Page<Item> itemPage = itemService.page(pageParam);
        long total = itemPage.getTotal();
        log.info("总数为:{}",total);
        return new PageDTO(itemPage.getTotal(),itemPage.getRecords());
    } */
}
